
#ifndef OBJECT_H
#define OBJECT_H

#include <Typedef.h>
#include <Defines.h>

#include <System/Activator.h>
#include <System/_Object.h>

namespace Riccsson
{
	namespace System
	{
		class String;
		class Type;

		class Object : protected _Object
		{
			protected: virtual void __static_constructor_initializer() {}
					   
			REGISTER_CLASS( Object )

		public:
			Object();
			virtual ~Object();

			// Summary:
			//     Determines whether the specified Riccsson::System::Object is equal to the current Riccsson::System::Object.
			//
			// Parameters:
			//   obj:
			//     The Riccsson::System::Object to compare with the current Riccsson::System::Object.
			//
			// Returns:
			//     true if the specified Riccsson::System::Object is equal to the current Riccsson::System::Object;
			//     otherwise, false.
			//[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
			virtual bool Equals(const Object* obj);
				
			//
			// Summary:
			//     Determines whether the specified Riccsson::System::Object instances are considered equal.
			//
			// Parameters:
			//   objA:
			//     The first Riccsson::System::Object to compare.
			//
			//   objB:
			//     The second Riccsson::System::Object to compare.
			//
			// Returns:
			//     true if the objects are considered equal; otherwise, false.
			//[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
			static bool Equals(const Object* objA, const Object* objB);
				
			//
			// Summary:
			//     Serves as a hash function for a particular type.
			//
			// Returns:
			//     A hash code for the current Riccsson::System::Object.
			//[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
			virtual int GetHashCode();
				
			//
			// Summary:
			//     Gets the Riccsson::System::Type of the current instance.
			//
			// Returns:
			//     The Riccsson::System::Type instance that represents the exact runtime type of the current
			//     instance.
			//[SecuritySafeCritical]
			GC_PTR<Type> GetType() const;
				
			//
			// Summary:
			//     Determines whether the specified Riccsson::System::Object instances are the same instance.
			//
			// Parameters:
			//   objA:
			//     The first Riccsson::System::Object to compare.
			//
			//   objB:
			//     The second Riccsson::System::Object to compare.
			//
			// Returns:
			//     true if objA is the same instance as objB or if both are null references;
			//     otherwise, false.
			//[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
			//[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
			static bool ReferenceEquals(const Object* objA, const Object* objB);
				
			//
			// Summary:
			//     Returns a Riccsson::System::String that represents the current Riccsson::System::Object.
			//
			// Returns:
			//     A Riccsson::System::String that represents the current Riccsson::System::Object.
			virtual GC_PTR<String> ToString();
			
			//---------------------------------------------------------------------------------------
			// This const method is a special hack just to skip implement duplicated ToString() in every classes.
			// It uses const_cast<Object*>(this) internally.
			GC_PTR<String> ToString() const;

		protected:
			//
			// Summary:
			//     Creates a shallow copy of the current Riccsson::System::Object.
			//
			// Returns:
			//     A shallow copy of the current Riccsson::System::Object.
			//[SecuritySafeCritical]
			GC_PTR<Object> MemberwiseClone();
		};

		inline bool operator ==(const Object& a, const Object& b)
		{
			return &a == &b;
		}
		
		typedef Object object;
	}
}


#endif
